home *** CD-ROM | disk | FTP | other *** search
/ Over 1,000 Windows 95 Programs / Over 1000 Windows 95 Programs (Microforum) (Disc 1).iso / 1157 / source / eztwain.pas < prev    next >
Pascal/Delphi Source File  |  1996-11-07  |  23KB  |  568 lines

  1. unit Eztwain;
  2. {
  3.  This unit is based on the eztwain.h for interfacing of the
  4.  eztwain.dll by spike. I included the original comments from
  5.  the source.
  6.  
  7.  The source of eztwain is available from:
  8.      <ftp://ftp.caere.com/pub/twain>
  9.  
  10.  This unit is sample code as like as the original eztwain.h.
  11.  Matthias Weingart '95.
  12. }
  13. {
  14. // EZTWAIN.H - interface to Easy TWAIN library
  15. //
  16. // EZTWAIN is not a product, and is not the work of any company involved
  17. // in promoting or using the TWAIN standard.  This code is sample code,
  18. // provided without charge, and you use it entirely at your own risk.
  19. // No rights or ownership is claimed by the author, or by any company
  20. // or organization.
  21. //
  22. // 0.0  05/11/94        created
  23. // 1.0a 06/23/94        first alpha version
  24. // 1.04 05/03/95        added: WriteNativeToFile, WriteNativeToFilename,
  25. //                                      FreeNative, SetHideUI, GetHideUI, SetCurrentUnits,
  26. //                                      GetCurrentUnits, SetCurrentResolution, SetBitDepth,
  27. //                                      SetCurrentPixelType, SetCapOneValue.
  28.         11/27/95    interface for delphi by Matthias Weingart
  29. }
  30.  
  31. interface
  32.  
  33. uses wintypes;
  34.  
  35. procedure TWAIN_Open(hwndApp: HWND; wPixTypes: word);
  36.   far;
  37. function  TWAIN_Acquire: HBitmap;
  38.   far;
  39. procedure TWAIN_Close;
  40.   far;
  41. function  TWAIN_LastMessage: word;
  42.   far;
  43.  
  44. function TWAIN_AcquireNative(hwndApp: HWND; wPixTypes: word): HBitmap;
  45.   far;
  46. {
  47. // The minimal use of EZTWAIN.DLL is to just call this routine, with 0 for
  48. // both params.  EZTWAIN creates a window if hwndApp is 0.
  49. //
  50. // Acquires a single image, from the currently selected Data Source, using
  51. // Native-mode transfer. It waits until the source closes (if it's modal) or
  52. // forces the source closed if not.  The return value is a handle to the
  53. // acquired image.  Only one image can be acquired per call.
  54. //
  55. // Under Windows, the return value is a global memory handle - applying
  56. // GlobalLock to it will return a (huge) pointer to the DIB, which
  57. // starts with a BITMAPINFOHEADER.
  58. // NOTE: You are responsible for disposing of the returned DIB - these things
  59. // can eat up your Windows memory fast!  See TWAIN_FreeNative below.
  60. //
  61. // The image type can be restricted using the following masks.  A mask of 0
  62. // means 'any pixel type is welcome'.
  63. // Caution: You should not assume that the source will honor a pixel type
  64. // restriction!  If you care, check the parameters of the DIB.
  65. }
  66. const
  67.      TWAIN_BW=1;          { 1-bit per pixel, B&W         (== TWPT_BW) }
  68.      TWAIN_GRAY=2;        { 1,4, or 8-bit grayscale  (== TWPT_GRAY) }
  69.      TWAIN_RGB=4;         { 24-bit RGB color         (== TWPT_RGB) }
  70.      TWAIN_PALETTE=8; { 1,4, or 8-bit palette    (== TWPT_PALETTE) }
  71.      TWAIN_ANYTYPE=0; { any of the above }
  72.  
  73. procedure TWAIN_FreeNative(hdib: HBitmap);
  74.  far;
  75. {
  76. // Release the memory allocated to a native format image, as returned by
  77. // TWAIN_AcquireNative. (If you are coding in C or C++, this is just a call
  78. // to GlobalFree.)
  79. // If you use TWAIN_AcquireNative and don't free the returned image handle,
  80. // it stays around taking up Windows (virtual) memory until your application
  81. // terminates.  Memory required per square inch:
  82. //             1 bit B&W       8-bit grayscale     24-bit color
  83. // 100 dpi      1.25KB              10KB               30KB
  84. // 200 dpi        5KB               40KB              120KB
  85. // 300 dpi      11.25KB             90KB              270KB
  86. // 400 dpi       20KB              160KB              480KB
  87. //
  88. }
  89. function TWAIN_AcquireToClipboard(hwndApp: HWND; wPixTypes: word): integer;
  90.  far;
  91. {
  92. // Like AcquireNative, but puts the resulting image, if any, into the system
  93. // clipboard.  Under Windows, this will put a CF_DIB item in the clipboard
  94. // if successful.  If this call fails, the clipboard is either empty or
  95. // contains the old contents.
  96. // A return value of 1 indicates success, 0 indicates failure.
  97. //
  98. // Useful for environments like Visual Basic where it is hard to make direct
  99. // use of a DIB handle.  In fact, TWAIN_AcquireToClipboard uses
  100. // TWAIN_AcquireNative for all the hard work.
  101. }
  102. function TWAIN_SelectImageSource(hwnd: HWND): integer;
  103.  far;
  104. {
  105. // This is the routine to call when the user chooses the "Select Source..."
  106. // menu command from your application's File menu.  Your app has one of
  107. // these, right?  The TWAIN spec calls for this feature to be available in
  108. // your user interface, preferably as described.
  109. // Note: If only one TWAIN device is installed on a system, it is selected
  110. // automatically, so there is no need for the user to do Select Source.
  111. // You should not require your users to do Select Source before Acquire.
  112. //
  113. // This function posts the Source Manager's Select Source dialog box.
  114. // It returns after the user either OK's or CANCEL's that dialog.
  115. // A return of 1 indicates OK, 0 indicates one of the following:
  116. //   a) The user cancelled the dialog
  117. //   b) The Source Manager found no data sources installed
  118. //   c) There was a failure before the Select Source dialog could be posted
  119. // -- details --
  120. // Only sources that can return images (that are in the DG_IMAGE group) are
  121. // displayed.  The current default source will be highlighted initially.
  122. // In the standard implementation of "Select Source...", your application
  123. // doesn't need to do anything except make this one call.
  124. //
  125. // If you want to be meticulous, disable your "Acquire" and "Select Source"
  126. // menu items or buttons if TWAIN_IsAvailable() returns 0 - see below.
  127. }
  128.  
  129. {--------- Basic TWAIN Inquiries  }
  130.  
  131. function TWAIN_IsAvailable: integer;
  132.  far;
  133. {
  134. // Call this function any time to find out if TWAIN is installed on the
  135. // system.  It takes a little time on the first call, after that it's fast,
  136. // just testing a flag.  It returns 1 if the TWAIN Source Manager is
  137. // installed & can be loaded, 0 otherwise.
  138. }
  139. function TWAIN_EasyVersion: integer;
  140.  far;
  141. {
  142. // Returns the version number of EZTWAIN.DLL, multiplied by 100.
  143. // So e.g. version 2.01 will return 201 from this call.
  144. }
  145. function TWAIN_State: integer;
  146.  far;
  147. {
  148. // Returns the TWAIN Protocol State per the spec.
  149. }
  150. const
  151.    TWAIN_PRESESSION=1;        { source manager not loaded }
  152.    TWAIN_SM_LOADED=2;         { source manager loaded }
  153.    TWAIN_SM_OPEN=3;           { source manager open }
  154.    TWAIN_SOURCE_OPEN=4;       { source open but not enabled }
  155.    TWAIN_SOURCE_ENABLED=5;    { source enabled to acquire }
  156.    TWAIN_TRANSFER_READY=6;    { image ready to transfer }
  157.    TWAIN_TRANSFERRING=7;          { image in transit }
  158.  
  159. {--------- BMP file utilities  }
  160.  
  161. function TWAIN_WriteNativeToFilename(hdib: HBitmap; pszFile: Pchar ): integer;
  162.  far;
  163. {
  164. // Writes a DIB handle to a .BMP file
  165. //
  166. // hdib         = DIB handle, as returned by TWAIN_AcquireNative
  167. // pszFile      = far pointer to NUL-terminated filename
  168. // If pszFile is NULL or points to a null string, prompts the user
  169. // for the filename with a standard file-save dialog.
  170. //
  171. // Return values:
  172. //       0      success
  173. //      -1      user cancelled File Save dialog
  174. //      -2      file open error (invalid path or name, or access denied)
  175. //      -3      (weird) unable to lock DIB - probably an invalid handle.
  176. //      -4      writing BMP data failed, possibly output device is full
  177. }
  178. function TWAIN_WriteNativeToFile(hdib: HBitmap; fh: integer): integer;
  179.  far;
  180. {
  181. // Writes a DIB to a file in .BMP format.
  182. //
  183. // hdib         = DIB handle, as returned by TWAIN_AcquireNative
  184. // fh           = file handle, as returned by _open, _lopen or OpenFile
  185. //
  186. // Return value as for TWAIN_WriteNativeToFilename
  187. }
  188.  
  189. { --------- Application Registration  }
  190.  
  191. procedure TWAIN_RegisterApp(            { record application information }
  192.         nMajorNum,nMinorNum: integer;   { major and incremental revision of application. E.g. }
  193.                                         { for version 2.1, nMajorNum == 2 and nMinorNum == 1 }
  194.         nLanguage: integer;             { language of this version (use TWLG_xxx from TWAIN.H) }
  195.         nCountry: integer;              { country of this version (use TWCY_xxx from TWAIN.H) }
  196.         lpszVersion: PChar;             { version info string e.g. "1.0b3 Beta release" }
  197.         lpszMfg: PChar;                 { name of manufacturer/developer e.g. "Crazbat Software" }
  198.         lpszFamily: PChar;              { product family e.g. "BitStomper" }
  199.         lpszProduct: PChar);            { specific product e.g. "BitStomper Deluxe Pro" }
  200.  far;
  201. {
  202. // TWAIN_RegisterApp can be called *AS THE FIRST CALL*, to register the
  203. // application. If this function is not called, the application is given a
  204. // 'generic' registration by EZTWAIN.
  205. // Registration only provides this information to the Source Manager and any
  206. // sources you may open - it is used for debugging, and (frankly) by some
  207. // sources to give special treatment to certain applications.
  208. }
  209.  
  210. { --------- Lower-level functions for greater control of the TWAIN protocol --------}
  211.  
  212. procedure TWAIN_SetHideUI(fHide: integer);
  213.  far;
  214. function TWAIN_GetHideUI: integer;
  215.  far;
  216. {
  217. // These functions control the 'hide source user interface' flag.
  218. // This flag is cleared initially, but if you set it non-zero, then when
  219. // a source is enabled it will be asked to hide its user interface.
  220. // Note that this is only a request - some sources will ignore it!
  221. // This affects AcquireNative, AcquireToClipboard, and EnableSource.
  222. // If the user interface is hidden, you will probably want to set at least
  223. // some of the basic acquisition parameters yourself - see
  224. // SetCurrentUnits, SetBitDepth, SetCurrentPixelType and
  225. // SetCurrentResolution below.
  226. }
  227. function TWAIN_GetResultCode: word;
  228.  far;
  229. {
  230. // Return the result code (TWRC_xxx) from the last triplet sent to TWAIN
  231. }
  232. function TWAIN_GetConditionCode: word;
  233.  far;
  234. {
  235. // Return the condition code from the last triplet sent to TWAIN.
  236. // (To be precise, from the last call to TWAIN_DS below)
  237. // If a source is NOT open, return the condition code of the source manager.
  238. }
  239. function TWAIN_LoadSourceManager: integer;
  240.  far;
  241. {
  242. // Finds and loads the Data Source Manager, TWAIN.DLL.
  243. // If Source Manager is already loaded, does nothing and returns TRUE.
  244. // This can fail if TWAIN.DLL is not installed (in the right place), or
  245. // if the library cannot load for some reason (insufficient memory?) or
  246. // if TWAIN.DLL has been corrupted.
  247. }
  248. function TWAIN_OpenSourceManager(hwnd: HWND): integer;
  249.  far;
  250. {
  251. // Opens the Data Source Manager, if not already open.
  252. // If the Source Manager is already open, does nothing and returns TRUE.
  253. // This call will fail if the Source Manager is not loaded.
  254. }
  255. function TWAIN_OpenDefaultSource: integer;
  256.  far;
  257. {
  258. // This opens the source selected in the Select Source dialog.
  259. // If a source is already open, does nothing and returns TRUE.
  260. // Fails if the source manager is not loaded and open.
  261. }
  262. function TWAIN_EnableSource(hwnd: HWND): integer;
  263.  far;
  264. {
  265. // Enables the open Data Source. This posts the source's user interface
  266. // and allows image acquisition to begin.  If the source is already enabled,
  267. // this call does nothing and returns TRUE.
  268. }
  269. function TWAIN_DisableSource: integer;
  270.  far;
  271. {
  272. // Disables the open Data Source, if any.
  273. // This closes the source's user interface.
  274. // If there is not an enabled source, does nothing and returns TRUE.
  275. }
  276. function TWAIN_CloseSource: integer;
  277.  far;
  278. {
  279. // Closes the open Data Source, if any.
  280. // If the source is enabled, disables it first.
  281. // If there is not an open source, does nothing and returns TRUE.
  282. }
  283. function TWAIN_CloseSourceManager(hwnd: HWND): integer;
  284.  far;
  285. {
  286. // Closes the Data Source Manager, if it is open.
  287. // If a source is open, disables and closes it as needed.
  288. // If the Source Manager is not open, does nothing and returns TRUE.
  289. }
  290. function TWAIN_UnloadSourceManager: integer;
  291.  far;
  292. {
  293. // Unloads the Data Source Manager i.e. TWAIN.DLL - releasing
  294. // any associated memory or resources.
  295. // This call will fail if the Source Manager is open, otherwise
  296. // it always succeeds and returns TRUE.
  297. }
  298. function TWAIN_MessageHook(lpmsg: PMsg): integer;
  299.  far;
  300. (*
  301. // This function detects Windows messages that should be routed
  302. // to an enabled Data Source, and picks them off.  In a full TWAIN
  303. // app, TWAIN_MessageHook is called inside the main GetMessage loop.
  304. // The skeleton code looks like this:
  305. //              MSG msg;
  306. //      while (GetMessage((LPMSG)&msg, NULL, 0, 0)) {
  307. //                      if (!TWAIN_MessageHook ((LPMSG)&msg)) {
  308. //                              TranslateMessage ((LPMSG)&msg);
  309. //                              DispatchMessage ((LPMSG)&msg);
  310. //                      }
  311. //              } // while
  312. *)
  313. procedure TWAIN_ModalEventLoop;
  314.  far;
  315. {
  316. // Process messages until termination, source disable, or image transfer.
  317. //
  318. // Executes exactly the sample code given above for TWAIN_MessageHook, but
  319. // terminates as soon as the source is disabled or a transfer completes.
  320. // This function is called by TWAIN_AcquireNative.
  321. }
  322. function TWAIN_AbortAllPendingXfers: integer;
  323.  far;
  324.  
  325. function TWAIN_WriteDibToFile(lpDIB: PBITMAPINFOHEADER; fh: integer): integer;
  326.  far;
  327. {
  328. // Writes a DIB to a file in .BMP format.
  329. // Returns TRUE if successful, FALSE otherwise.
  330. // (Likely causes of failure: device full, or permission denied to write to file or device
  331. // lpDIB        = pointer to DIB, as from GlobalLock of DIB handle
  332. // fh           = file handle, as returned by C _open or Windows _lopen or OpenFile
  333. // For example of use, see TWAIN_WriteNativeToFilename in EZTWAIN.C
  334. }
  335. function TWAIN_NegotiateXferCount(nXfers: integer): integer;
  336.  far;
  337. {
  338. // Negotiate with open Source the number of images application will accept.
  339. // This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
  340. // nXfers = -1 means any number
  341. }
  342. function TWAIN_NegotiatePixelTypes(wPixTypes: word): integer;
  343.  far;
  344. {
  345. // Negotiate with the source to restrict pixel types that can be acquired.
  346. // This tries to restrict the source to a *set* of pixel types,
  347. // See TWAIN_AcquireNative above for some mask constants.
  348. // --> This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
  349. // A parameter of 0 (TWAIN_ANYTYPE) causes no negotiation & no restriction.
  350. // You should not assume that the source will honor your restrictions, even
  351. // if this call succeeds!
  352. }
  353. function TWAIN_GetCurrentUnits: integer;
  354.  far;
  355. {
  356. // Ask the source what its current unit of measure is.
  357. // If anything goes wrong, this function just returns TWUN_INCHES (0).
  358. }
  359. function TWAIN_SetCurrentUnits(nUnits: integer): integer;
  360.  far;
  361. {
  362. // Set the current unit of measure for the source.
  363. // Unit of measure codes are in TWAIN.H, but TWUN_INCHES is 0.
  364. }
  365. const
  366.      TWUN_INCHES=0;
  367.      TWUN_CENTIMETERS=1;
  368.      TWUN_PICAS=2;
  369.      TWUN_POINTS=3;
  370.      TWUN_TWIPS=4;
  371.      TWUN_PIXELS=5;
  372.  
  373. function TWAIN_GetBitDepth: integer;
  374.  far;
  375. {
  376. // Get the current bitdepth, which can depend on the current PixelType.
  377. // Bit depth is per color channel e.g. 24-bit RGB has bit depth 8.
  378. // If anything goes wrong, this function returns 0.
  379. }
  380. function TWAIN_SetBitDepth(nBits: integer): integer;
  381.  far;
  382. {
  383. // (Try to) set the current bitdepth (for the current pixel type).
  384. }
  385. function TWAIN_GetPixelType: integer;
  386.  far;
  387. {
  388. // Ask the source for the current pixel type.
  389. // If anything goes wrong (it shouldn't), this function returns 0 (TWPT_BW).
  390. }
  391. function TWAIN_SetCurrentPixelType(nPixType: integer): integer;
  392.  far;
  393. {
  394. // (Try to) set the current pixel type for acquisition.
  395. // This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
  396. // The source may select this pixel type, but don't assume it will.
  397. }
  398. function TWAIN_GetCurrentResolution: double;
  399.  far;
  400. {
  401. // Ask the source for the current resolution.
  402. // Resolution is in dots per current unit! (See TWAIN_GetCurrentUnits above)
  403. // If anything goes wrong (it shouldn't) this function returns 0.0
  404. }
  405. function TWAIN_SetCurrentResolution(dRes: double): integer;
  406.  far;
  407. {
  408. // (Try to) set the current resolution for acquisition.
  409. // Resolution is in dots per current unit! (See TWAIN_GetCurrentUnits above)
  410. // This is only allowed in State 4 (TWAIN_SOURCE_OPEN)
  411. // Note: The source may select this resolution, but don't assume it will.
  412. }
  413.  
  414. { --------- Low-level capability negotiation functions --------
  415.  
  416. // Setting a capability is valid only in State 4 (TWAIN_SOURCE_OPEN)
  417. // Getting a capability is valid in State 4 or any higher state.
  418. }
  419. function TWAIN_SetCapOneValue( Cap:      word;
  420.                                ItemType: word;
  421.                                ItemVal:  longint): integer;
  422.  far;
  423. {
  424. // Do a DAT_CAPABILITY/MSG_SET, on capability 'Cap' (e.g. ICAP_PIXELTYPE,
  425. // CAP_AUTOFEED, etc.) using a TW_ONEVALUE container with the given item type
  426. // and value.  Obviously, the item value must fit into 32 bits.
  427. // Returns TRUE (1) if successful, FALSE (0) otherwise.
  428. }
  429. function TWAIN_GetCapCurrent( Cap:      word;
  430.                               ItemType: word;
  431.                               pVal: pointer): integer;  {far pointer!}
  432.  far;
  433. {
  434. // Do a DAT_CAPABILITY/MSG_GETCURRENT on capability 'Cap'.
  435. // Copy the current value out of the returned container into *pVal.
  436. // If the operation fails (the source refuses the request), or if the
  437. // container is not a ONEVALUE or ENUMERATION, or if the item type of the
  438. // returned container is incompatible with the expected TWTY_ type in nType,
  439. // returns FALSE.  If this function returns FALSE, *pVal is not touched.
  440. }
  441.  
  442. { --------- Lowest-level functions for TWAIN protocol -------- }
  443.  
  444. function TWAIN_DS(DG: longint; DAT: word; MSG: word; pData: Pointer): integer;
  445.  far;
  446. {
  447. // Passes the triplet (DG, DAT, MSG, pData) to the open data source if any.
  448. // Returns 1 (TRUE) if the result code is TWRC_SUCCESS, 0 (FALSE) otherwise.
  449. // The last result code can be retrieved with TWAIN_GetResultCode(), and the corresponding
  450. // condition code can be retrieved with TWAIN_GetConditionCode().
  451. // If no source is open this call will fail, result code TWRC_FAILURE, condition code TWCC_NODS.
  452. }
  453. function TWAIN_Mgr(DG: longint; DAT: word; MSG: word; pData: Pointer): integer;
  454.  far;
  455. {
  456. // Passes a triplet to the Data Source Manager (DSM).
  457. // Returns 1 (TRUE) if the result code is TWRC_SUCCESS, 0 (FALSE) otherwise.
  458. // The last result code can be retrieved with TWAIN_GetResultCode(), and the corresponding
  459. // condition code can be retrieved with TWAIN_GetConditionCode().
  460. // If the Source Manager is not open, this call will fail, and set the result code to TWRC_FAILURE,
  461. // with a condition code of TWCC_SEQERROR (triplet out of sequence).
  462. }
  463.  
  464. implementation
  465.  
  466. procedure TWAIN_Open(hwndApp: HWND; wPixTypes: word);
  467.   external 'EZTWAIN';
  468. function TWAIN_Acquire: HBitmap;
  469.   external 'EZTWAIN';
  470. procedure TWAIN_Close;
  471.   external 'EZTWAIN';
  472. function  TWAIN_LastMessage: word;
  473.   external 'EZTWAIN';
  474.  
  475.  
  476. function TWAIN_AcquireNative(hwndApp: HWND; wPixTypes: word): HBitmap;
  477.   external 'EZTWAIN';
  478. procedure TWAIN_FreeNative(hdib: HBitmap);
  479.   external 'EZTWAIN';
  480. function TWAIN_AcquireToClipboard(hwndApp: HWND; wPixTypes: word): integer;
  481.   external 'EZTWAIN';
  482. function TWAIN_SelectImageSource(hwnd: HWND): integer;
  483.   external 'EZTWAIN';
  484. function TWAIN_IsAvailable: integer;
  485.   external 'EZTWAIN';
  486. function TWAIN_EasyVersion: integer;
  487.   external 'EZTWAIN';
  488. function TWAIN_State: integer;
  489.   external 'EZTWAIN';
  490. function TWAIN_WriteNativeToFilename(hdib: HBitmap; pszFile: PChar ): integer;
  491.   external 'EZTWAIN';
  492. function TWAIN_WriteNativeToFile(hdib: HBitmap; fh: integer): integer;
  493.   external 'EZTWAIN';
  494. procedure TWAIN_RegisterApp( nMajorNum,nMinorNum: integer;
  495.                              nLanguage: integer;
  496.                              nCountry: integer;
  497.                              lpszVersion: PChar;
  498.                              lpszMfg: PChar;
  499.                              lpszFamily: PChar;
  500.                              lpszProduct: PChar);
  501.   external 'EZTWAIN';
  502. procedure TWAIN_SetHideUI(fHide: integer);
  503.   external 'EZTWAIN';
  504. function TWAIN_GetHideUI: integer;
  505.   external 'EZTWAIN';
  506. function TWAIN_GetResultCode: word;
  507.   external 'EZTWAIN';
  508. function TWAIN_GetConditionCode: word;
  509.   external 'EZTWAIN';
  510. function TWAIN_LoadSourceManager: integer;
  511.   external 'EZTWAIN';
  512. function TWAIN_OpenSourceManager(hwnd: HWND): integer;
  513.   external 'EZTWAIN';
  514. function TWAIN_OpenDefaultSource: integer;
  515.   external 'EZTWAIN';
  516. function TWAIN_EnableSource(hwnd: HWND): integer;
  517.   external 'EZTWAIN';
  518. function TWAIN_DisableSource: integer;
  519.   external 'EZTWAIN';
  520. function TWAIN_CloseSource: integer;
  521.   external 'EZTWAIN';
  522. function TWAIN_CloseSourceManager(hwnd: HWND): integer;
  523.   external 'EZTWAIN';
  524. function TWAIN_UnloadSourceManager: integer;
  525.   external 'EZTWAIN';
  526. function TWAIN_MessageHook(lpmsg: PMsg): integer;
  527.   external 'EZTWAIN';
  528. procedure TWAIN_ModalEventLoop;
  529.   external 'EZTWAIN';
  530. function TWAIN_AbortAllPendingXfers: integer;
  531.   external 'EZTWAIN';
  532. function TWAIN_WriteDibToFile(lpDIB: PBITMAPINFOHEADER; fh: integer): integer;
  533.   external 'EZTWAIN';
  534. function TWAIN_NegotiateXferCount(nXfers: integer): integer;
  535.   external 'EZTWAIN';
  536. function TWAIN_NegotiatePixelTypes(wPixTypes: word): integer;
  537.   external 'EZTWAIN';
  538. function TWAIN_GetCurrentUnits: integer;
  539.   external 'EZTWAIN';
  540. function TWAIN_SetCurrentUnits(nUnits: integer): integer;
  541.   external 'EZTWAIN';
  542. function TWAIN_GetBitDepth: integer;
  543.   external 'EZTWAIN';
  544. function TWAIN_SetBitDepth(nBits: integer): integer;
  545.   external 'EZTWAIN';
  546. function TWAIN_GetPixelType: integer;
  547.   external 'EZTWAIN';
  548. function TWAIN_SetCurrentPixelType(nPixType: integer): integer;
  549.   external 'EZTWAIN';
  550. function TWAIN_GetCurrentResolution: double;
  551.   external 'EZTWAIN';
  552. function TWAIN_SetCurrentResolution(dRes: double): integer;
  553.   external 'EZTWAIN';
  554. function TWAIN_SetCapOneValue( Cap: word;
  555.                                ItemType: word;
  556.                                ItemVal: longint): integer;
  557.   external 'EZTWAIN';
  558. function TWAIN_GetCapCurrent( Cap:      word;
  559.                               ItemType: word;
  560.                               pVal: pointer): integer;
  561.   external 'EZTWAIN';
  562. function TWAIN_DS(DG: longint; DAT: word; MSG: word; pData: Pointer): integer;
  563.   external 'EZTWAIN';
  564. function TWAIN_Mgr(DG: longint; DAT: word; MSG: word; pData: Pointer): integer;
  565.   external 'EZTWAIN';
  566.  
  567. end.
  568.